/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.permission.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.Q200;
import queenb.web.permission.inteface.Q200Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class Q200Store extends Q200 implements Q200Inf{

    @Override
    public List<Q200> getListQ200L(int pnPQ350) {
         try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_Q200L, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnPQ350)
                   });
           return super.find(dataStatement, Q200.class);
        } catch (SQLException ex) {
                Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<Q200> getListQ200R(int pnFQ350) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_Q200R, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFQ350)
                   });
           return super.find(dataStatement, Q200.class);
        } catch (SQLException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

//    @Override
//    public int deleteQ200(int pnFN100, int pnFN850, int pvLOGIN) {
//        DataStatement deleteN900Statement = new DataStatement(PackageContants.DELETE_Q200, OracleTypes.INTEGER, new Param[]{
//                    new Param(OracleTypes.INTEGER, pnFN100),
//                    new Param(OracleTypes.INTEGER, pnFN850),
//                    new Param(OracleTypes.CHAR, pvLOGIN)
//                });
//        try {
//            return super.update(deleteN900Statement, null);
//        } catch (SQLException ex) {
//            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
//            return 0;
//        }
//    }

    @Override
    public int updateQ200(int pnFH000, int pnFQ350, int pnFQ100, String pvLOGIN) {
       DataStatement updateN900Statement = new DataStatement(PackageContants.UPDATE_Q200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFQ350),
                    new Param(OracleTypes.INTEGER, pnFQ100),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(updateN900Statement, null);
        } catch (SQLException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return  0;
        }
    }

    @Override
    public int deleteQ200(int pnFH000, int pnFQ350, int pnFQ100, String pvLOGIN) {
        DataStatement updateN900Statement = new DataStatement(PackageContants.DELETE_Q200, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFQ350),
                    new Param(OracleTypes.INTEGER, pnFQ100),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(updateN900Statement, null);
        } catch (SQLException ex) {
            Logger.getLogger(Q200Store.class.getName()).log(Level.SEVERE, null, ex);
            return  0;
        }
    }
    
}
